const app = getApp()

module.exports = (url,data,method="get",header={})=>{
  wx.showLoading({
    title: '加载中...',
    mask:true
  })

  return new Promise((resolve,reject)=>{
    wx.request({
      url: app.config.baseUrl + url,
      data,
      method,
      header,
      dataType:'json',
      success:resolve,
      fail:reject,
      complete:wx.hideLoading()
    })
  })
}